package com.edu.neusoft.elec_shop.service;

import com.edu.neusoft.elec_shop.domain.User;
import com.edu.neusoft.elec_shop.mapper.UserMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

@Service
public class UserService {

    @Resource
    private UserMapper userMapper;

    // 用户注册
    public int register(User user) {return userMapper.insert(user);}
    public int insert(User record) {return userMapper.insert(record);}


    // 根据用户ID获取用户信息，登录用
    public User getUserById(Long userId) {return userMapper.selectByUserId(userId);}

    //用户修改个人信息
    public int updateByUserId(User record) {return userMapper.updateByUserId(record);}

    //用户注销账户
    public int deleteByUserId(Long userId) {return userMapper.deleteByUserId(userId);}
}